package com.dfrz.ch09.task;

import com.dfrz.ch06.tackTeacher.CountHeight05;
import com.sun.media.sound.SoftTuning;

import javax.sql.rowset.CachedRowSet;
import java.util.Scanner;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/20 9:52
 * 描述:
 */
public class CarTest {
    public static void main(String[] args) {
        Car[] cars=new Car[4];

        Car car1=new Car(600,1,1);
        Car car2=new Car(500,1,2);
        Car car3=new Car(700,2,3);
        Car car4=new Car(800,2,4);

        cars[0]=car1;
        cars[1]=car2;
        cars[2]=car3;
        cars[3]=car4;

        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入您要的天数");

        int day=scanner.nextInt();

        System.out.println("请输入要租赁的汽车类型（１：轿车　２：客车）");

        int subject=scanner.nextInt();

        Car[] cars2=new Car[4];
             int conut=0;
        for (int i=0;i<cars.length;i++) {
            if (cars[i].getSubject()==subject){
                cars2[conut]=cars[i];
                conut++;
            }
        }

        System.out.println("请输入要租赁的汽车车型（１：宝马　２：别克  3：小金杯　4：大金杯）");

        int model=scanner.nextInt();

        com.dfrz.ch09.task.Car car=new com.dfrz.ch09.task.Car();
        for (int i = 0; i<conut; i++) {
            if (cars2[i].==model){
              car=cars2[i];
               break;
            }
        }

        System.out.println("分配给您的汽车排好是：闽Ａ００９０１");

        System.out.println("顾客您好，您需要支付的租赁费用为"+(car.getPrice()*day)+"。");


    }
}
